package com.example.demo.service.impl;

import com.example.demo.mapper.UserMapper;
import com.example.demo.pojo.User;
import com.example.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YKH
 * Date: 2023-01-07
 * Time: 11:24
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserMapper userMapper;

    /**
     * 注册
     * @param username
     * @param finalPassword
     * @return
     */
    @Override
    public boolean register(String username, String finalPassword) {
       return userMapper.register(username, finalPassword);
    }

    /**
     * 根据用户姓名获取用户信息
     * @param username
     * @return
     */
    @Override
    public User getUserByUserName(String username) {
        return userMapper.getUserByUserName(username);
    }

    /**
     * 根用户Id获取用户信息
     * @param uid
     * @return
     */
    @Override
    public User getUerById(int uid) {
        return userMapper.getUserById(uid);
    }

}
